package com.richman.hg;

import com.richman.controller.BetClient;

public class HGThread extends Thread {

	public long sleepTime = 30*1000;
	HGManager hgmanager = null;
	
	
	public long lastUpdatetime = 0;
	
	boolean start = false;
	boolean loginNow = false;
	
	
	boolean bexit = false;
	
	public boolean getbexit() {
		return bexit;
	}

	public HGThread(){		

	}
	
	
	@Override
    public void run() {

		try{

			while(BetClient.bStartEngine){
				try{

					BetClient.mainWnd.updateHGTextArea(BetClient.showtext);
					BetClient.betCtrMng.keepHGonline();
					
					BetClient.betCtrMng.updatehgBetLogData();
					
					
					
					BetClient.betCtrMng.checkIllegalBet();
					
					BetClient.betCtrMng.checkSpecialIllegalBet();
					
					//DaShuiClient.betCtrMng.getRedcard();
					
					if(BetClient.betCtrMng!=null && System.currentTimeMillis() > lastUpdatetime + 10*1000) {
						BetClient.betCtrMng.updateBetAdyTable();
						lastUpdatetime = System.currentTimeMillis();
					}
					
					Thread.sleep(500);
					
				}catch(Exception e){
					e.printStackTrace();
					Thread.sleep(2000);
				}
				

			}

			bexit = true;

		}catch(Exception e){
			e.printStackTrace();
		}	
	}
	
}
